package interaction.input;

import processing.core.PVector;
import interaction.data.DataChangeListener;
import interaction.data.DataSource;

public abstract class DataComponent<T> extends AbstractComponent {
	private DataSource<T> data;

	public DataComponent(PVector position, PVector size) {
		super(position, size);
		this.data = new DataSource<T>(null);
	}

	public DataSource<T> getDataSource() {
		return data;
	}
	
	public DataComponent<T> attachDataChangeListener(DataChangeListener<T> l)
	{
		getDataSource().addListener(l);
		return this;
	}
}
